package com.example.test.dialogfactory;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;

public class MainActivity105 extends AppCompatActivity {

    private DrawerLayout drawer;
    private ConstraintLayout root;
    private ConstraintLayout menu;
    private Button open;
    private Button close;

    public static void start( Context context ) {

        Intent starter = new Intent( context, MainActivity105.class );
        context.startActivity( starter );
    }

    @Override
    protected void onCreate( Bundle savedInstanceState ) {

        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main105 );
        initView();
    }

    private void initView() {

        drawer = findViewById( R.id.drawer );
        root = findViewById( R.id.root );
        menu = findViewById( R.id.menu );
        open = findViewById( R.id.open );
        close = findViewById( R.id.close );

        open.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                drawer.openDrawer( GravityCompat.END );
            }
        } );
        close.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                drawer.closeDrawer( GravityCompat.END );
            }
        } );
        drawer.setDrawerLockMode( DrawerLayout.LOCK_MODE_LOCKED_CLOSED );
    }
}